﻿function wPDFjs()
{
	var wPDFView = typeof PDFView != "undefined" ? PDFView : null;

	var _wPDFViewObj =
	{
		getCurrentPageNumber: function()
		{
			return wPDFView.page;
		},

		setCurrentPageNumber: function(val)
		{
			wPDFView.page = val;
		},

		getPageCanvas: function(pageNumber)
		{
			return wPDFView.pages[pageNumber - 1].canvas;
		},

		isViewFinished: function(pageNumber)
		{
			return wPDFView.isViewFinished(wPDFView.pages[pageNumber - 1]);
		},

		pagesCount: function()
		{
			return wPDFView.pages.length;
		},

		cleanup: function()
		{
			wPDFView.cleanup();
		}
	};

	this.GetCurrentPageNumber = function()
	{
		return _wPDFViewObj.getCurrentPageNumber();
	};

	this.SetCurrentPageNumber = function(val)
	{
		return _wPDFViewObj.setCurrentPageNumber(val);
	};

	this.GetPageCanvas = function(pageIndex)
	{
		return _wPDFViewObj.getPageCanvas(pageIndex);
	};

	this.IsViewFinished = function(pageIndex)
	{
		return _wPDFViewObj.isViewFinished(pageIndex);
	};

	this.PagesCount = function()
	{
		return _wPDFViewObj.pagesCount();
	};

	this.Cleanup = function()
	{
		_wPDFViewObj.cleanup();
	};
}

SSVC.Wrap.Dojo.SetObject("SSVC.Wrap.PDFjs", new wPDFjs());